home *** CD-ROM | disk | FTP | other *** search
- /* Illustration of logarithmic axes, and redefinition of window using */
- /* Windowing commands of MathFX library. */
- /* Copyright (©) 1995, The Xperts Group Inc. All Rights Reserved. */
- /* Author: Manolis S Pappas. */
-
- #include <math.h>
-
- main()
- {
- int i;
- float freql[101],ampl[101],phase[101];
- float f0, freq;
-
- fxstar(1,1);
- fxadv(0);
- fxfont(2);
-
- f0 = 1000.0;
- for (i=0; i<=100; i++) {
- freql[i]=1.0+i/20.0;
- freq= pow(10.0,freql[i]);
- ampl[i]=20.0*log10(1.0/sqrt(1.0+pow((freq/f0),2.)));
- phase[i]=-(180.0/3.141592654)*atan(freq/f0);
- }
-
- fxvpor(0.15,0.85,0.1,0.9);
- fxwind(1.0,6.0,-80.0,0.0);
- fxbox("bclnst",0.0,0,"bnstv",0.0,0);
- fxline(101,freql,ampl);
- fxptex(5.0,-30.0,1.0,-20.0,0.5,"-20 dB/decade");
- fxwind(1.0,6.0,-100.0,0.0);
- fxbox(" ",0.0,0,"cmstv",30.0,3);
- fxline(101,freql,phase);
-
- fxmtex("b",3.2,0.5,0.5,"Frequency");
- fxmtex("t",2.0,0.5,0.5,"Single Pole Low-Pass Filter");
- fxmtex("l",5.0,0.5,0.5,"Amplitude (dB)");
- fxmtex("r",5.0,0.5,0.5,"Phase shift (degrees)");
-
- fxend();
- }
-